<template>
  <div class="q-pa-md">
    <div class="q-pb-lg">
      <t-toggle v-model="dense" label="Dense QSelect" />
      <t-toggle v-model="denseOpts" label="Dense options" />
    </div>

    <div class="q-gutter-md" style="max-width: 300px">
      <t-select
        filled
        v-model="model"
        :options="options"
        label="Label (stacked)"
        stack-label
        :dense="dense"
        :options-dense="denseOpts"
      />

      <t-select
        outlined
        v-model="model"
        :options="options"
        :dense="dense"
        :options-dense="denseOpts"
      >
        <template v-slot:prepend>
          <t-icon name="event" />
        </template>
      </t-select>

      <t-select
        standout
        v-model="model"
        :options="options"
        :dense="dense"
        :options-dense="denseOpts"
      >
        <template v-slot:append>
          <t-avatar>
            <img src="https://cdn.quasar.dev/logo-v2/svg/logo.svg" />
          </t-avatar>
        </template>
      </t-select>

      <t-select
        filled
        bottom-slots
        v-model="model"
        :options="options"
        label="Label"
        counter
        :dense="dense"
        :options-dense="denseOpts"
      >
        <template v-slot:prepend>
          <t-icon name="place" @click.stop.prevent />
        </template>
        <template v-slot:append>
          <t-icon
            name="close"
            @click.stop.prevent="model = ''"
            class="cursor-pointer"
          />
        </template>

        <template v-slot:hint> Field hint </template>
      </t-select>

      <t-select
        rounded
        outlined
        bottom-slots
        v-model="model"
        :options="options"
        label="Label"
        counter
        maxlength="12"
        :dense="dense"
        :options-dense="denseOpts"
      >
        <template v-slot:before>
          <t-icon name="flight_takeoff" />
        </template>

        <template v-slot:append>
          <t-icon
            v-if="model !== ''"
            name="close"
            @click.stop.prevent="model = ''"
            class="cursor-pointer"
          />
          <t-icon name="search" @click.stop.prevent />
        </template>

        <template v-slot:hint> Field hint </template>
      </t-select>

      <t-select
        filled
        bottom-slots
        v-model="model"
        :options="options"
        label="Label"
        counter
        maxlength="12"
        :dense="dense"
        :options-dense="denseOpts"
      >
        <template v-slot:before>
          <t-avatar>
            <img src="https://cdn.quasar.dev/img/avatar5.jpg" />
          </t-avatar>
        </template>

        <template v-slot:append>
          <t-icon
            v-if="model !== ''"
            name="close"
            @click.stop.prevent="model = ''"
            class="cursor-pointer"
          />
          <t-icon name="schedule" @click.stop.prevent />
        </template>

        <template v-slot:hint> Field hint </template>

        <template v-slot:after>
          <t-btn round dense flat icon="send" />
        </template>
      </t-select>

      <t-select
        filled
        bottom-slots
        v-model="model"
        :options="options"
        label="Label"
        counter
        maxlength="12"
        :dense="dense"
        :options-dense="denseOpts"
      >
        <template v-slot:before>
          <t-icon name="event" />
        </template>

        <template v-slot:hint> Field hint </template>

        <template v-slot:append>
          <t-btn round dense flat icon="add" @click.stop.prevent />
        </template>
      </t-select>
    </div>
  </div>
</template>

<script>
  import { ref } from 'vue';

  export default {
    setup() {
      return {
        model: ref(null),

        options: ['Google', 'Facebook', 'Twitter', 'Apple', 'Oracle'],

        dense: ref(false),
        denseOpts: ref(false),
      };
    },
  };
</script>
